package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/09/05 13:06
 **/
public class Day3_4_Offer53_Search {
    class Solution {
        public int search(int[] nums, int target) {
            int left = 0, right = nums.length-1, mid, conut = 0;
            while(left < right){
                mid = left + ((right-right)>>1);
                if(nums[mid] >= target){
                    right = mid;
                }else left = mid+1;
            }
            while(left < nums.length && nums[left++] == target) conut++;
            return conut;
        }
    }
}